
import java.util.Arrays;
import java.util.Scanner;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Jam_Gadang
 */
public class aplikasi {
public static void main(String[] args){
Scanner input= new Scanner(System.in);
System.out.println("               Aplikasi Penjadwalan Proses Dengan Algoritma Shortest Jobs First");
int i,a,b,p1,p2,p3,p4,p5,rata,jml=0;
int[] beban= new int[5];

for(i=0;i<=4;i++){
a=i+1;
System.out.print("               Masukan Proses ke "+a+" ");
beban[i]=input.nextInt();
}

p1=beban[0];
p2=beban[1];
p3=beban[2];
p4=beban[3];
p5=beban[4];
System.out.print("               ");

Arrays.sort(beban);
for(i=0;i<=4;i++){
if(beban[i]==p1){
System.out.print("P1");
}
if(beban[i]==p2){
System.out.print("P2");
}
if(beban[i]==p3){
System.out.print("P3");
}
if(beban[i]==p4){
System.out.print("P4");
}
if(beban[i]==p5){
System.out.print("P5");
}
jml=jml+beban[i];
for(a=0;a<jml;a++){
if(jml-a==1){
System.out.print("|");
}
else{
System.out.print("-");
}
}
}
System.out.println();
System.out.print("               ");
System.out.print("0 ");
jml=0;
for(i=0;i<=4;i++){
jml=jml+beban[i];
for(a=0;a<jml;a++){
if(jml-a==1){
System.out.print(jml+"  ");
}
else{
System.out.print(" ");
}
}
}
System.out.println();
rata=jml/5;
System.out.println("               Rata-rata= "+rata);
}
}


